package heimaObject;

public class Student {
  String name;
  int age;
  private int money = 100000;

  // 构造方法  对对象数据进行初始化; 被 new Student() 关键字调用
  public Student() {
    System.out.println("无参构造方法");
  }
  // 构造方法的 重载
  public Student(int age) {
    this.age = age;
  }

  public Student(String name) {
    this.name = name;
  }

  public Student(int age, String name) {
    this.age = age;
    this.name = name;
  }

  public void setMoney(int m) {
    this.money = m;
    if (m > 0) {
      System.out.println(this.name + "是个有钱人 。");
    }
  }

  public int getMoney() {
    return this.money;
  }

  public void study() {
    System.out.println("学习...");
  }

  public void doHomework() {
    System.out.println("写作业...");
  }

  public void showMoney() {
    System.out.println(this.name + "的存款：" + this.money);
  }
  public void show(){
    System.out.println(this.name);
    System.out.println(this.age);
  }
}
